<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<title></title>
		<link rel="stylesheet" type="text/css" href="../../../resource/css/bootstrap.min.css"/>
		<link rel="stylesheet" type="text/css" href="../../../resource/css/jedate.css"/>
		<link rel="stylesheet" type="text/css" href="../../../resource/fonts/iconfont.css"/>
		<link rel="stylesheet" type="text/css" href="../../../resource/css/common.css"/>
		<style type="text/css">
			/*.erp-txt span{width: 100px;!*padding-right: 20px;*! }*/
		</style>
	</head>
	<body>
		<div class="container-fluid">
			<div class="row mheader">
				<div class="col-xs-2 text-left"><a href="javascript:;" onclick="javascript:history.back(-1);"><span class="iconfont icon-fanhui"></span></a></div>
				<div class="col-xs-8"><h2>材料供应单签收管理</h2></div>
				<div class="col-xs-2 text-right"><!-- <a href="#">编辑</a> --></div>
			</div>
			<div class="row">
				<dl id="dd1" class="erp-list erp-details">

				</dl>
				
				<dl id="dd2" class="erp-list erp-details">

				</dl>

				<dl id="dd3" class="erp-order">
					<dt>材料供应单</dt>

				</dl>
			
				<!--<div style="margin-bottom: 80px;"></div>-->
				<!--<div class="order-send"><a href="erp-order.html" class="btn btn-warning">发货</a></div>-->

			</div>
		</div>
	</body>
</html>
<script src="https://cdn.bootcss.com/jquery/2.2.4/jquery.min.js"></script>
<script src="../../../resource/js/bootstrap.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../resource/js/style.js"></script>

<script type="text/javascript">
	//点击改变申请单高度
	$(document).ready(function(){
		$(".more").click(function(){
			$(this).siblings(".order-li").toggleClass("orderHeight");
		  });

		//获取code
		var rm_code=window.location.href.split("?")[1];
        rm_code=rm_code.split('&&');
        var validates=rm_code[1].split('=');
        rm_code=rm_code[0].split('=');
        validates=validates[1];
        rm_code=rm_code[1];
        console.log(validates)

//		  var data = sessionStorage.getItem('lhr_clxqgl');
//		  data = JSON.parse(data);
//        console.log(data);
        // var model2 = '<dd>' +
        //     '<div class="erp-txt">' +
        //     '<p><span>采购单经手人:</span>'+data.+'</p>' +
        //     '<p><span>供货单经手人:</span>李四</p>' +
        //     '<p><span>收料单经手人:</span>王</p>' +
        //     '</div>' +
        //     '</dd>'
        //
        var sendData = {'type':'b'};
        sendData['remark'] = rm_code;
        sendData['p'] = getP();
        ajaxs(
            "api/supply/suppSignMana.do",
			'post',
			sendData,
			function (data) {
            data = data.data;
            //主表数据
			var model1 = '<dd>' +
				'<div class="erp-txt visa-txt">' +
				'<p><span>供料单号:</span>'+data[0].rm_Code+'</p>' +
				'<p><span class="sp">项目名称:</span><span class="divCon">'+data[0].eppName+'('+data[0].eppStaEnd+')'+'</span></p>' +
				'<p><span class="sp">施工单位:</span><span class="divCon">'+data[0].compName1+'</span></p>' +
				'<p><span>供货时间:</span>'+isun(data[0].rm_Time)+'</p>' +
				'<p><span class="sp">供货地址:</span><span class="divCon">'+data[0].r_adr+'</span></p>' +
				'<p><span>签收状态:</span>{{validates}}</p>' +
				'</div>' +
				'</dd>'

			if (validates == -1){
				model1 = model1.replace('{{validates}}','等待签收');
			}else if (validates == 0){
				model1 = model1.replace('{{validates}}','已签收');
			}else {
				model1 = model1.replace('{{validates}}','拒绝签收');
			}

			$('#dd1').html(model1);
			//
			var html = '';
            for (var i=0;i<data.length;i++){
                switch (data[i].validate){
                    case -1:
                        data[i].validate='等待审核';
                        break;
                    case 0:
                        data[i].validate='审核通过';
                        break;
                    case 1:
                        data[i].validate='审核不通过';
                        break;
                    case 2:
                        data[i].validate='已发货';
                        break;
                }
                var model = '<dd>' +
                    '<p><span>材料名称:</span>'+data[i].mat_Name+'</p>' +
                    '<div class="order-li clearfix">' +
                    '' +
                    '<div class="col-xs-6"><span>送料数量:</span><strong>'+data[i].send_Num+'</strong><span>'+data[i].mat_Bit+'</span></div>' +
                    '<div class="col-xs-6"><span>规格:</span>'+data[i].mat_Spec+'</div>' +
                    '<div class="col-xs-6"><span>签收数量:</span><strong>'+isunnum(data[i].rm_Num)+'</strong><span>'+data[i].mat_Bit+'</span></div>' +
                    '<div class="col-xs-6"><span>审核状态:</span>'+data[i].validate+'</div>' +
                    '<div class="col-xs-6"><span>审批数量:</span><strong>'+isunnum(data[i].fin_Num)+'</strong><span>'+data[i].mat_Bit+'</span></div>' +
                    '</div>' +
                    '</dd>'
                console.log(data[i])
                console.log(data[i].validate)



                html += model;
            }

            $('#dd3').html($('#dd3').html() + html);

        });
	});


    function isun(data) {
        if (data == undefined){
            return '';
        }
        return data;
    }
    function isunnum(data) {
        if (data == undefined){
            return 0;
        }
        return data;
    }

</script>











